﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace Royaume
{
   
	public partial class ProductionMilitaire : System.Web.UI.Page
	{
        SqlConnection cnt;
        SqlCommand cmd;
        cSql objsql = new cSql("(local)", "DB_GAME", "RoyaumesLibres", "123456");

		protected void Page_Load(object sender, EventArgs e)
		{
            this.cnt = Connect.getconnectionstringG();
		}

        protected void btnvalid_Click(object sender, EventArgs e)
        {
            cnt.Open();

            string selectedvalue = Request.Form["MaRadio"];
            this.cmd = new SqlCommand();
            this.cmd.Connection = this.cnt;

            this.cmd.CommandText = "spShowSoldier";
            this.cmd.CommandType = CommandType.StoredProcedure;
            this.cmd.Parameters.Clear();
            this.cmd.Parameters.Add("@PkMembre", SqlDbType.Int).Value = Session["pkUser"];
            
            int text = (int)cmd.ExecuteScalar();
            this.lblmessage.Text = "Votre production de" + selectedvalue + " ce terminera dans " + text.ToString() + " heures";

            
            //lblmessage.Text = this.txtunit.Text + " " + selectedvalue + " sont en production"  ;

            cnt.Close();
        }
	}
}